<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    // 修改length长度
    var arr = ['red','green','blue'];
    console.log(arr);
    arr.length=4;
    arr[3] = 'yellow';
    console.log(arr);

    // 新增数组元素，修改索引号
    var arr1 = [1,2,3];
    console.log(arr1);
    arr1[3]= 4;
    console.log(arr1);

    var arr2 = [];
    for(var i = 0; i<10;i++){
        arr2[i] = i+1; 

    }console.log(arr2);

    var arr3 = [2,0,6,1,77,0,52,7];
    var arr4 = [];
    var j = 0;
    for(var i =0; i<arr3.length;i++){
        if(arr3[i]>=10){
            arr4[j] = arr3[i];
            j++;
        }
    }console.log(arr4);

    var arr3 = [2,0,6,1,77,0,52,7];
    var arr4 = [];
    for(var i =0; i<arr3.length;i++){
        if(arr3[i]>=10){
            arr4[arr4.length] = arr3[i];
        }
    }console.log(arr4);

</script>
<body>
    
</body>
</html>